#ifndef OA_CORE_EVENTSUBSCRIBER_H
#define OA_CORE_EVENTSUBSCRIBER_H

#include "util.h"
#include "core/eventhandler.h"

namespace core {
	template <class> class EventHandlerQueue;

	template <typename tEventType, class tHandler>
	class _OA_export EventBridge: public EventHandler<tEventType> {
	private:
		friend class EventHandlerQueue<tEventType>;

		tHandler& mHandler;		

		EventBridge(tHandler& handler);

		void handle(const tEventType& type);

		bool operator == (const tHandler& handler) const;
	};

	//Implementation
	template <typename T, class U>
	EventBridge<T, U>::EventBridge(U& handler): 
		mHandler(handler) 
	{
	}

	template <typename T, class U>
	void EventBridge<T, U>::handle(const T& object) {
		mHandler.handle(object);
	}

	template <typename T, class U>
	bool EventBridge<T, U>::operator == (const U& handler) const {
		return ((&mHandler) == (&handler));
	}
}

#endif
